/**
 * 获取 token
 */
export function getToken(key) {
  if (document.cookie) {
    var arr = {};
    document.cookie.split('; ').map(value => {
      value = value.trim();
      arr[value.substring(0, value.indexOf('='))] = value.substring(
        value.indexOf('=') + 1,
        value.length,
      );
    });
    return arr[key];
  } else {
    return false;
  }
}

/**
 * 获取url参数
 * name 为你需要获取的参数名称
 */
export function getUrlKey(name){
    return decodeURIComponent((new RegExp('[?|&]'+name+'='+'([^&;]+?)(&|#|;|$)').exec(location.href)||[,""])[1].replace(/\+/g,'%20'))||null;
}
